
use.interval=0.0001
use.table=qnorm(seq(use.interval,1-use.interval,use.interval))
n.table.options=length(use.table)


simulate.DSTP=function(N,params,maxCounter,stepSize,congruency,use.table,n.table.options) {
  
  rts=rep(0,N)
  resps=rep(0,N)
  
  zA=(params["z"]*(params["a"]+params["a"]))-params["a"]
  zC=(0.5*(params["c"]+params["c"]))-params["c"]
  
  tmp=.C("DSTP",zRS=zA,zTS=zC,
         aURS=params["a"],aUTS=params["c"],aLRS=-params["a"],aLTS=-params["c"],
         ter=params["ter"],
         vT=params["vT"],vA=params["vA"],vSS=params["vSS"],vRS2=params["vRS2"],
         svT=params["sv"],svA=params["sv"],svSS=params["sv"],svRS2=params["sv"],
         szRS=params["sz"],szTS=params["sz"],
         ster=params["ster"],
         sRS=params["stoch.s"],sTS=params["stoch.s"],
         congruency=as.double(congruency),
         h=stepSize,resp=resps,rt=rts,
         n=N,maxiter=as.double(round(maxCounter)),
         rangeLow=as.integer(0),rangeHigh=as.integer(n.table.options-1),
         randomTable=as.double(use.table)) 
  
  out=list(rt=tmp$rt,resp=tmp$resp)
}

